prolog './g020a.ijs'
NB. B > B ---------------------------------------------------------------

randuni''

x=: ?100$2
y=: ?100$2
(x>y) -: (#.x,.y){0 0 1 0
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:?2
(x>z) -: x>($x)$z    [ z=:?2

(x>y) -: (40$"0 x)>y [ x=: ?10$2    [ y=: ?10 40$2
(x>y) -: x>40$"0 y   [ x=: ?10 40$2 [ y=: ?10$2

0 0 1 0 -: 0 0 1 1 > 0 1 0 1


NB. B > I ---------------------------------------------------------------

x=: ?100$2
y=: _1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:?2
(x>z) -: x>($x)$z    [ z=:_1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: ?10$2    [ y=: _1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: ?10 40$2 [ y=: _1e5+?10$2e5

0 0 1 0 1 0 0 1 -: 0 0 1 1 0 0 1 1 > 0 1 0 1 _4 3 4 _3
1 1 -: 0 1 > _2147483648
0 0 -: 0 1 >  2147483647


NB. B > D ---------------------------------------------------------------

x=: ?100$2
y=: o._1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:?2
(x>z) -: x>($x)$z    [ z=:o._1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: ?10$2    [ y=: o._1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: ?10 40$2 [ y=: o._1e5+?10$2e5

0 0 1 0 1 0 1 0 -: 0 0 1 1 0 0 1 1 > 0 1 0 1 _2.5 1.2 _2.5 1.2
(14 6#1 0) -: 1>1-10^-i.20
1 0 1 0 -: 0 0 1 1 > __ _ __ _


NB. I > B ---------------------------------------------------------------

x=: _1e5+?100$2e5
y=: ?100$2
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:_1e5+?2e5
(x>z) -: x>($x)$z    [ z=:?2

(x>y) -: (40$"0 x)>y [ x=: _1e5+?10$2e5    [ y=: ?10 40$2
(x>y) -: x>40$"0 y   [ x=: _1e5+?10 40$2e5 [ y=: ?10$2

0 0 1 1 -: _3 _3 4 4 > 0 1 0 1
1 1 -:  2147483647 > 0 1
0 0 -: _2147483648 > 0 1


NB. I > I ---------------------------------------------------------------

x=: _1e5+?100$2e5
y=: _1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:?2e6
(x>z) -: x>($x)$z    [ z=:_1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: _1e5+?10$2e5    [ y=: _1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: _1e5+?10 40$2e5 [ y=: _1e5+?10$2e5

1 1 1 1 0 0 0 0 -: 4>i.8
0 0 0 0 0 1 1 1 -: (i.8)>4
0 0 0 0 0 0 -: _2147483648 > 2 0 1e9 2e9 _2147483648 2147483647
1 1 1 1 1 0 -:  2147483647 > 2 0 1e9 2e9 _2147483648 2147483647


NB. I > D ---------------------------------------------------------------

x=: _1e5+?100$2e5
y=: o._1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:?2e6
(x>z) -: x>($x)$z    [ z=:o._1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: _1e5+?10$2e5    [ y=: o._1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: _1e5+?10 40$2e5 [ y=: o._1e5+?10$2e5

1 1 1 1 0 0 0 0 -: 4>0.5+i.8
0 0 0 0 1 1 1 1 -: (0.5+i.8)>4
0 0 0 0 0 0 -: _2147483648 >2.5 0 1e9 2e9 _2147483648 2147483647
1 1 1 1 1 0 -:  2147483647 >2.5 0 1e9 2e9 _2147483648 2147483647
(14 6#1 0) -: 17 > 17*1-10^-i.20
1 0 1 0 -: 4 4 _5 _5 > __ _ __ _
1 0 1 0 -: _2147483648 _2147483648 2147483647 2147483647 > __ _ __ _


NB. D > B ---------------------------------------------------------------

x=: o._1e5+?100$2e5
y=: ?100$2
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:o._1e5+?2e5
(x>z) -: x>($x)$z    [ z=:?2

(x>y) -: (40$"0 x)>y [ x=: o._1e5+?10$2e5    [ y=: ?10 40$2
(x>y) -: x>40$"0 y   [ x=: o._1e5+?10 40$2e5 [ y=: ?10$2

(14 6#1 0) -: (1+10^-i.20) > 1
(20$1) -: ( 10^-i.20) > 0
(20$0) -: (-10^-i.20) > 0


NB. D > I ---------------------------------------------------------------

x=: o._1e5+?100$2e5
y=: _1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:o._1e5+?2e5
(x>z) -: x>($x)$z    [ z=:_1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: o._1e5+?10$2e5    [ y=: _1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: o._1e5+?10 40$2e5 [ y=: _1e5+?10$2e5

(14 6#1 0) -: (17*1+10^-i.20) > 20$17
0 0 1 1 -: __ __ _ _ > _1e9+?4$2e9


NB. D > D ---------------------------------------------------------------

x=: o._1e5+?100$2e5
y=: o._1e5+?100$2e5
(x>y) -: (z+x)>z+y   [ z=:{.0 4.5
(x>y) -: (z*x)>z*y   [ z=:{.1 4j5
(z>y) -: (($y)$z)>y  [ z=:o._1e5+?2e5
(x>z) -: x>($x)$z    [ z=:o._1e5+?2e5

(x>y) -: (40$"0 x)>y [ x=: o._1e5+?10$2e5    [ y=: o._1e5+?10 40$2e5
(x>y) -: x>40$"0 y   [ x=: o._1e5+?10 40$2e5 [ y=: o._1e5+?10$2e5

1 -: (o.1) > ^1
0 -: 1x1 > 1p1

NB. D (compare[!.0] |) D

y =: , (i: 5) +/ _5e_15 _1e_15 0 1e_15 5e_15
x =: 2048 ?@$ 0
f =: {{
a =. u"u |  NB. no prim support
b =. u |  NB. tolerant
c =. u!.0"u |  NB. intolerant, no prim
d =. u!.0 |  NB. intolerant prim
assert. (a -: b)"0/~ y
assert. (c -: d)"0/~ y
assert. (7!:2 'a~ x') > 2 * (7!:2 'b~ x')
NB. removed because sometimes failed assert. (10000 (6!:2) 'b~ x') > 1.3 * (10000 (6!:2) 'd~ x')
1 return.
x
}}
x = f y
x ~: f y
x < f y
x <: f y
x >: f y
x > f y

NB. SB > SB ---------------------------------------------------------------

1 0 0 1 -: (s:' a b c d') > (s:' A b c D')
1 0 0 1 -: (s:' a b c d') > (s:' Aa ba ca Da')
1 1 1 1 -: (s:' a bb ccc dddd') > (s:' Aa baa cacc Daddd')
1 0 0 1 -: (s:' a bb ccc dddd') > (s:' Aa bbb cccc Daddd')

0 0 0 0 -:  (s:' A b c D') > (s:' a b c d')
0 1 1 0 -:  (s:' Aa ba ca Da') > (s:' a b c d')
0 0 0 0 -:  (s:' Aa baa cacc Daddd') > (s:' a bb ccc dddd')
0 1 1 0 -:  (s:' Aa bbb cccc Daddd') > (s:' a bb ccc dddd')

((<:#sdot0)$0) -: (}:sdot0) > (}.sdot0)
((<:#sdot0)#1) -: (}.sdot0) > (}:sdot0)

(((-:@#sdot0)#1),((-:@#sdot0)#0)) -: (|.sdot0) > (sdot0)
(((-:@#sdot0)#0),((-:@#sdot0)#1)) -: (sdot0) > (|.sdot0)

((2 4, 8%~#sdot0)$0) -: ((2 4, 8%~#sdot0)$ }:sdot0) > ((2 4, 8%~#sdot0)$ }.sdot0)
((2 4, 8%~#sdot0)$1) -: ((2 4, 8%~#sdot0)$ }.sdot0) > ((2 4, 8%~#sdot0)$ }:sdot0)

(((4, 8%~#sdot0)$1),:((4, 8%~#sdot0)$0)) -: ((2 4, 8%~#sdot0)$ |.sdot0) > ((2 4, 8%~#sdot0)$ sdot0)
(((4, 8%~#sdot0)$0),:((4, 8%~#sdot0)$1)) -: ((2 4, 8%~#sdot0)$ sdot0) > ((2 4, 8%~#sdot0)$ |.sdot0)

randfini''


epilog''

